import threading


#创建全局ThreadLocal对象
local_school=threading.local()
def process_student():
    #获取当前线程关联的threadlocal的student属性
    std=local_school.student
    print('hello %s (in %s)'%(std,threading.current_thread().name))
def process_thread(name):
    #绑定threadlocal的student属性
    local_school.student=name
    process_student()
t1=threading.Thread(target=process_thread,args=('画手啊啊啊啊',),name='thread-A')
t2=threading.Thread(target=process_thread,args=('今麦郎啊啊啊',),name='thread-B')
t1.start()
t2.start()
t1.join()
t2.join()